package com.beyond.common.manager

import com.beyond.common.bean.UserBean
import com.beyond.common.constant.SPConstantKeys
import com.beyond.common.util.SpUtil

/**
 * @author chenshiyang
 * @time 2022/9/23 15:09
 * @name veo-android
 * @class describe
 */
object UserManager {
    @JvmStatic
    var user: UserBean? = null
        get() {
            return field ?: SpUtil.getData(
                SPConstantKeys.SP_APP_USER,
                UserBean::class.java
            )
        }
        set(value) {
            field = value
            SpUtil.putData(SPConstantKeys.SP_APP_USER, value)
        }

    fun clear() {
        user = null
        SpUtil.remove(SPConstantKeys.SP_APP_USER)
    }
}